package com.wang.wx.utils;

public class Utf8StringConversion {
    public static void Utf8String(String originalString) {
        try {
            // 将字符串编码为UTF-8字节数组
            byte[] utf8Bytes = originalString.getBytes("UTF-8");

            // 从UTF-8字节数组构建字符串
            String utf8String = new String(utf8Bytes, "UTF-8");

            // 输出转换后的字符串
            System.out.println("Original String: " + originalString);
            System.out.println("UTF-8 Encoded String: " + utf8String);

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    
    public static void main(String[] args) {
        Utf8StringConversion.Utf8String("𦍋大維");
    }
}